/*
 * Boolean.cpp
 *
 *  Created on: May 2, 2012
 *      Author: lorenzo
 */

#include "Literal.h"

Literal::Literal(unsigned int index, bool negation, Formula* formula)
{
	this->index = index;
	this->negation = negation;
	this->formula = formula;
}

Literal::~Literal() {

}



bool Literal::evaluate(){
	if (formula != 0)
	{
		if (negation){
			return !(formula->getVarValue(index));
			}
		return formula->getVarValue(index);
	}

	//throw ..

	return false;
}

/*
void Literal::setValue(bool newValue){
	*value = newValue;
}*/


unsigned int Literal::getIndex(){
	return index;
}


bool Literal::isNegated(){
	return negation;
}
